<template>
  <div>
      <div class="banner" @click="handleBannerClick">
      <img class="banner-img" :src="bannerImg" alt="">
      <div class="banner-info">
        <div class="banner-title">{{this.sightName}}</div>
        <div class="banner-num">
          <div class="banner-icon"></div>
          {{this.bannerImgs.length}}
        </div>
      </div>
    </div>
    <fade-animation>
      <common-gallary :imgs="bannerImgs" v-show="showGallary" @close="handleGallryClose"></common-gallary>
    </fade-animation>
  </div>
</template>

<script>
import CommonGallary from 'common/gallary/Gallary'
import FadeAnimation from 'common/fade/FadeAnimation'
export default {
  name: 'DetailBanner',
  data () {
    return {
      showGallary: false,
      imgs: ['//img1.qunarzz.com/sight/p0/1711/fe/fe517fa5a183e4bca3.img.jpg_600x330_a413e5b1.jpg', 'http://img1.qunarzz.com/sight/p0/1711/f7/f714e5736f6ba7c9a3.img.jpg_r_800x800_ac31e249.jpg']
    }
  },
  components: {
    CommonGallary,
    FadeAnimation
  },
  methods: {
    handleBannerClick () {
      this.showGallary = true
    },
    handleGallryClose () {
      this.showGallary = false
    }
  },
  props: {
    sightName: String,
    bannerImg: String,
    bannerImgs: Array
  }
}
</script>

<style scoped>
  .banner{
    overflow: hidden;
    height: 0;
    padding-bottom: 55%;
    position: relative;
  }
  .banner-img{
    width: 100%;
  }
  .banner-info{
    display: flex;
    position: absolute;
    bottom: 0;
    left:0;
    justify-content: space-between;
    width: 100%;
    align-items: center;
    color: #fff;
  }
  .banner-title{
    font-size: .32rem;
    padding: .2rem;
  }
  .banner-num{
    margin-top: .1rem;
    padding: 0 0.4rem;
    height: .32rem;
    line-height: 0.32rem;
    border-radius: .2rem;
    background: rgba(0,0,0,.8);
    margin-right: .2rem;
    font-size: .24rem;
    display: flex;
    align-items: center;
  }
  .banner-icon{
    width: 0.2rem;
    height: 0.2rem;
    /*background: red;*/
    background: url("https://i.postimg.cc/28Vnx7tN/icon.png") 0 0 no-repeat;
    background-size: 100% 100% ;
    margin-right: 0.05rem;
  }
</style>
